<?php
function checkLength($str,$min,$max) {
    preg_match_all("/./", $str, $matches);
    $len = count($matches[0]);
    if ($len < $min || $len > $max) {
        return false;
    } else {
        return true;
    }
}